package com.cs2.volunteerpostbackend.web.advice;

import com.cs2.volunteerpostbackend.web.dto.RespEntity;
import com.cs2.volunteerpostbackend.web.excpetion.BaseException;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class ExceptionAdvice {
    @ExceptionHandler
    @ResponseBody
    public RespEntity ExceptionHnadler(BaseException e) {
        e.printStackTrace();
        return new RespEntity("5000", "服务器异常"+e.getMessage(), null);
    }
}
